package com.onion.utils.utils;

import cn.hutool.core.bean.BeanUtil;

import java.util.ArrayList;
import java.util.List;

public class BeanHelper {

    public static <T,R> List<R> convert(List<T> listData, Class<R> clazz){
        List<R> listResult = new ArrayList<>();
        for(T data : listData){
            listResult.add(BeanUtil.toBean(data, clazz));
        }
        return listResult;
    }

    public static <R> R convert(Object data, Class<R> clazz){
        return BeanUtil.toBean(data, clazz);
    }

}